// HEAD UTILITY H
/*==================================================================================================================
                  Copyright (C) 2013 SUMSCOPE L.P.
                  ALL RIGHTS RESERVED 
====================================================================================================================
File description:
    Utility class to define some utility functions

====================================================================================================================
...Date      Name                                  Description of Change
17-Apr-2013  James Xu                              Initial version
25-Apr-2013  James Xu                              Add GetRemainingMaturity
$HISTORY$
===================================================================================================================*/
#ifndef UTILITY_H
#define UTILITY_H

#include <vector>
#include "BondDataStructure.h"

struct YieldPoints
{
    double maturity;
    double yield;
};

bool operator<(const YieldPoints& a, const YieldPoints& b);

void sort(std::vector<double>& x, std::vector<double>& y);

// Get remaining years from start and end dates, format=yyyymmdd
double GetRemainingMaturity(int startDate, int endDate);

// Use previous day's quote as today's.
void FillMissingData(std::vector<double>& yields);

#endif